# Archlive <http://archlive-pkg.googlecode.com>

pkgname=ndiswrapper-2.6.32
_kernver=2.6.32-ARCH
pkgver=1.55
pkgrel=1
pkgdesc="Module for NDIS (Windows Network Drivers) drivers supplied by vendors. For stock arch 2.6.32 kernel."
license=('GPL')
arch=(i686 x86_64)
url="http://ndiswrapper.sourceforge.net"
install="ndiswrapper.install"
depends=('kernel26=2.6.32')
conflicts=("ndiswrapper" "ndiswrapper-utils")
provides=("ndiswrapper=$pkgver" "ndiswrapper-utils=$pkgver")
source=(http://downloads.sourceforge.net/sourceforge/ndiswrapper/ndiswrapper-$pkgver.tar.gz
	module-init-tools.patch		2.6.32.patch
)

build()
{
  cd $srcdir/ndiswrapper-$pkgver
  patch -Np1 -i $srcdir/2.6.32.patch || return 1

  cd driver
  make KVERS=$_kernver || return 1
  make DESTDIR=$pkgdir KVERS=$_kernver install || return 1
  rm $pkgdir/lib/modules/$_kernver/modules.* #wtf?

  mkdir -p $pkgdir/lib/modules/$_kernver/kernel/drivers/net/wireless/ndiswrapper
  mv $pkgdir/lib/modules/$_kernver/misc/* $pkgdir/lib/modules/$_kernver/kernel/drivers/net/wireless/ndiswrapper/
  rm -r $pkgdir/lib/modules/$_kernver/misc/

  cd ../utils
  # fix module init tools config file
  patch -Np1 -i ../../module-init-tools.patch || return 1
  make || return 1
  make DESTDIR=$startdir/pkg install
}
